1. Field of the Invention
The invention relates to the field of relational, object-oriented and object relational databases. More particularly, the invention relates to a structured natural language database query and knowledge system.
2. Description of the Related Art
Relational databases have been used widely for many years. A relational database organizes data into tables that include fields. Two tables that include a same field are related to each other. Compared to the “flat file” approach that stores all data into a single file, the relational approach of tables is more flexible.
Most relational database systems conform to the Structured Query Language (SQL) standard. Commercial vendors produce SQL based database systems such as Oracle, Sybase, Informix, Progress and Microsoft Access. These systems use a SQL-type formal query language. The following are examples of a formal query used to display the names and salaries of those employees who make more than $100,000:
For each employee where employee.salary > 100000:                Display employee.name employee.salary.        
End
Or:
Select name, salary
From employee
Where employee.salary > 100000
In the above queries, “employee” is the table name, “name” and “salary” are fields of the “employee” table, “where employee.salary > 100000” is a condition and also a qualification, and “Display employee.name employee.salary” and “Select name, salary” are commands. A qualification is a condition or a plurality of conditions connected by logical connectors such as “and”, “or”, “and not” or “or not”.
Object-oriented databases organize data into objects. An object can have attributes, which can also be objects. The recursive nature of an object permits ease of manipulation. Objects can inherit characteristics from other objects, making it easier to create new objects based on existing ones. An object can be associated with a set of procedures (methods) to manipulate its data.
Attempts have been made to combine relational databases and object-oriented databases to create object relational databases. For example, American National Standards Institute (ANSI) SQL-99 extends the conventional SQL query language to allow tables and fields to be manipulated as objects. A typical ANSI SQL-99 query is expressed as:
Select arguments
From type var, . . . . type var
Where condition and condition . . . and condition
A condition is a method with the method's arguments applied to a variable. An argument of the “select” command can be a variable, an attribute of a variable or a method with its arguments applied to a variable. With the addition of methods, the scope of SQL-99 becomes wider than the scope of conventional SQL.
Unfortunately, ANSI SQL-99 still has significant limitations. As described below in more detail, ANSI SQL-99 allows only “range” type variables and does not allow “set,” “bag,” or temporary variables. The scope of a variable is determined by its type (which is usually a relational table or a class of objects) and cannot be an arbitrary set of objects. Moreover, a condition under SQL-99 does not allow the values produced by a method, whether produced as its returned value or as its parameters, to be used in other conditions. In addition, a method that does not return a logical “true” or “false” value is not allowed to be a condition. Therefore, it would be desirable to introduce a more general and more powerful object relational query language.
Conventional relational algebra has significant limitations too. Under relational algebra, an expression is simply a relation such as a flat file or a set of records whose fields are primitive values such as integers, floating point numbers and text strings. Moreover, a condition of the “select” operator is restricted to:
1. A comparison between two primitive values such as equal to, greater than, less than, greater than or equal to, less than or equal to, not equal to;
2. A comparison between a primitive value and a set of primitive values produced by a sub-query such as “is a member of,” “greater than all members of,” “greater than any member of,” and so forth;
3. A comparison between two sets of primitive values produced by a sub-query such as “is a superset of” or “is a subset of”; and
4. A test on a set of primitive values such as “is an empty set.”
In addition, a method typically is not allowed to be an expression under relational algebra. Therefore, it would be desirable to introduce a more general and more powerful object relational algebra.
Conventional databases use data integrity constraints and event triggers to enforce rules on the databases. However, the scope of these rules is limited by the scope of the query language used by the conventional databases. What is desired is a knowledge system that permits more powerful and more flexible ways of specifying rules.
Finally, in a conventional relational or object relational database, a user who lacks programming skills typically cannot compose complex database queries, and must rely on programs written by programmers to search and display data. Therefore the user's options are frequently very limited. It would be desirable to allow such a user to write natural language type instructions to operate on a relational, object-oriented or object relational database in real time.